import request from '@/utils/request'

// 查询公司基本信息列表
export function listCompanyBase(query) {
  return request({
    url: '/company/companyBase/list',
    method: 'get',
    params: query
  })
}

// 查询所有公司
export function findAllCompany(query) {
  return request({
    url: '/company/companyBase/findAllList',
    method: 'get',
    params: query
  })
}

// 获取所有存在财务数据的公司列表
export function listPcwCompany(query) {
  return request({
    url: '/company/companyBase/pcwCompanyList',
    method: 'get',
    params: query
  })
}

// 根据项目类型查询公司基本信息列表
export function listDealTypeCompany(query) {
  return request({
    url: '/company/companyBase/listDealTypeCompany',
    method: 'get',
    params: query
  })
}

export function listDealTypeCompanySelect(query) {
  return request({
    url: '/company/companyBase/listDealTypeCompanySelect',
    method: 'get',
    params: query
  })
}

export function companySelectOption(query) {
  return request({
    url: '/company/companyBase/companySelectOption',
    method: 'get',
    params: query
  })
}

// 查询公司基本信息详细
export function getCompanyBase(id) {
  return request({
    url: '/company/companyBase/' + id,
    method: 'get'
  })
}

// 查询公司基本信息详细
export function getCompanyBaseByDealId(dealId, companyId) {
  return request({
    url: '/company/companyBase/' + dealId + '/' + companyId,
    method: 'get'
  })
}

// 保存公司基本信息
export function saveCompanyBase(data) {
  return request({
    url: '/company/companyBase/save',
    method: 'post',
    data: data
  })
}

// 删除公司基本信息
export function delCompanyBase(id) {
  return request({
    url: '/company/companyBase/' + id,
    method: 'delete'
  })
}

// 导出公司基本信息
export function exportCompanyBase(query) {
  return request({
    url: '/company/companyBase/export',
    method: 'get',
    params: query
  })
}

// 根据公司名称模糊匹配公司列表
export function companyListByName(companyName) {
  return request({
    url: '/company/companyBase/companyListByName?companyName=' + companyName,
    method: 'get'
  })
}

// 根据天眼查ID或者公司名称获取公司工商详情
export function companyDetailsByName(query) {
  return request({
    url: '/company/companyBase/companyDetailsByName',
    method: 'get',
    params: query
  })
}

// 根据天眼查ID或者公司名称获取公司工商详情
export function getCompanyByName(query) {
  return request({
    url: '/company/companyBase/getCompanyByName',
    method: 'get',
    params: query
  })
}

export function getCompanyBaseByName(query) {
  return request({
    url: '/company/companyBase/getCompanyBaseByName',
    method: 'get',
    params: query
  })
}

export function listCompanyByInvestName(companyName) {
  return request({
    url: '/company/companyBase/listCompanyBaseByName?companyName=' + companyName,
    method: 'get'
  })
}

// 用户头像上传
export function uploadAvatar(data) {
  return request({
    url: '/company/companyBase/avatar',
    method: 'post',
    data: data
  })
}

// 查询经营风险的天眼查更新时间
export function listRiskTianyanchaUpdate(query) {
  return request({
    url: '/company/companyBase/listRiskTianyanchaUpdate',
    method: 'get',
    params: query
  })
}

// 根据项目id查询公司信息
export function getCompanyByDealId(dealId) {
  return request({
    url: '/company/companyBase/getCompanyByDealId/' + dealId,
    method: 'get'
  })
}

// 根据公司ID更新天眼查数据
export function updateBusinessInfoByCompanyId(companyId) {
  return request({
    url: '/company/companyBase/updateBusinessInfoByCompanyId/' + companyId,
    method: 'get'
  })
}
